<?php

/**
 * Smarty模板处理类
 */
require HDPHP_PATH . 'Org/Smarty/Smarty.class.php';
class SmartyView {
      protected $viewObj = null;
      function __construct() {
            $this->viewObj = new Smarty(); //实例化Smarty对象
            $this->viewObj->template_dir = TPL_PATH . CONTROL . '/'; //模板目录
            $this->viewObj->compile_dir = APP_PATH . 'Temp/Compile/' . CONTROL . '/'; //模板目录
            is_dir($this->viewObj->template_dir) or mkdir($this->viewObj->template_dir, true, 0755); //自动创建模板目录
            is_dir($this->viewObj->compile_dir) or mkdir($this->viewObj->compile_dir, true, 0755); //自动创建编译目录

      }
//调用模板
      function display($tpl) {
            $this->viewObj->display($tpl);
      }
//分配变量
      function assign($var,$data) {
            $this->viewObj->assign($var,$data);
      }
}

?>
